#pragma once

#include "mysqlx/xdevapi.h"

/* 单例，全局唯一 */
class db {
public:
    static db& get_instance() {
        static db instance;
        return instance;
    }

    mysqlx::Table get_table(const std::string &name)
    {
        return schema_.getTable(name);
    }

private:
    db() :
        session_("127.0.0.1", 33060, "root", "root"),
        schema_(session_, "minesweeper_server_db")
    {

    }


    ~db() = default;
    mysqlx::Session session_;
    mysqlx::Schema schema_;
};
